package com.service;

import com.dao.orderDao;
import com.pojo.order;

import java.sql.ResultSet;
import java.sql.SQLException;

public class orderService {
    private orderDao orderDao=new orderDao();

    /**
     *查询用户的所有订单
     */
    public ResultSet queryAllOrder(int userid) throws SQLException, ClassNotFoundException {
        ResultSet resultSet = orderDao.queryAllOrder(userid);
        return resultSet;
    }

    /**
     *添加订单
     */
    public boolean addOrder(order order) throws SQLException, ClassNotFoundException {
        boolean isAddSuccess = orderDao.add(order);
        return isAddSuccess;
    }

    /**
     *删除订单
     */
    public boolean deleteOrder(int userid,String orderid) throws SQLException, ClassNotFoundException {
        boolean isdelete = orderDao.deleteOrder(userid,orderid);
        return  isdelete;
    }

    /**
     * 查询单个订单
     */
    public ResultSet queryOneOrder(int userid,String orderid) throws SQLException, ClassNotFoundException {
        ResultSet resultSet = orderDao.queryOneOrder(userid, orderid);
        return resultSet;
    }

    /**
     * 确认收货
     * @param userid
     * @param orderid
     */
    public void receiveSuccess(int userid,String orderid){
        try {
            orderDao.receiveSuccess(userid,orderid);
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }









}
